package com.aabte.design2.behavioral.state;

/**
 * 具体状态会实现与上下文状态相关的多种行为
 *
 * @author Daniel
 * @version 1.0
 * @date 2020/5/4
 */
public class LockedState extends State {
    public LockedState(AudioPlayer player) {
        super(player);
    }

    @Override
    void clickLock() {
        if (player.isPlaying()) {
            player.changeState(new PlayingState(player));
        } else {
            player.changeState(new ReadyState(player));
        }
    }

    @Override
    void clickPlay() {
        System.out.println("已锁定，什么也不做");
    }

    @Override
    void clickNext() {
        System.out.println("已锁定，什么也不做");
    }

    @Override
    void clickPrevious() {
        System.out.println("已锁定，什么也不做");
    }
}
